class JobService {

    boolean transactional = true

    def updateJob(Job jobInstance) {
        if (!jobInstance.pointAddToCustomer && jobInstance.status == Constants.JOB_STATUS_PENDING) {
            Customer customer = jobInstance.customer
            if (customer.isMember()) {
                customer.point += jobInstance.point
                jobInstance.pointAddToCustomer = true

                customer.balance -= jobInstance.actualValue

                customer.save()
            }
        }

        return jobInstance.save()

    }
}
